#ifndef GAMECONTRAL_H
#define GAMECONTRAL_H

#include <QObject>

#include"robotplayer.h"
#include"userplayer.h"
#include"cards.h"

class GameContral : public QObject
{
    Q_OBJECT
public:
    explicit GameContral(QObject *parent = nullptr);
    //设置状态:玩家状态和游戏状态
    enum GameStatusEnum {
           DealingCards,    // 发牌状态
           BiddingLandlord, // 叫地主状态
           PlayingCards     // 出牌状态
       };
    enum PlayerStatusEnum {
            ConsideringBiddingLandlord, // 考虑叫地主
            ConsideringPlayingCard,     // 考虑出牌
            Won                         // 获胜
        };
  //初始化玩家信息
    void  initPlayer();
  //获取当前玩家的信息
    Player* getCurrentPlayer();
    void  setCurrentPlayer(Player*player);
   //设置和获取已经出了的牌
    void setPendCards(Cards*cards);
    Cards getPendCards();
    void setPendPlayer(Player*player);
    Player*getPendPlayer();
    //初始化所有的牌
    void  initAllCards();
    //随机发牌
    Card takeRandomOneCard();
    //得到最后的三张底牌
    Cards takeLastThreeCards();
    //重新洗牌
    void resetCards();
    //处理叫地主
    void becomeLander(Player*player);
    void callLander(Player*player);

signals:
private:
    UserPlayer*userPlayer;
    RobotPlayer*robotPlayerLeft;
    RobotPlayer*robotPlayerRight;
    //当前玩家
    Player*currentPlayer;
    //出牌
    Cards PendCards;
    Player* PendPlayer;
    //所有的牌
    Cards allCards;
};

#endif // GAMECONTRAL_H
